/*
  Copyright 1996-2003
  Simon Whiteside

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

 * $Id: Tracer.java,v 1.6 2003/02/24 18:10:53 simkin_cvs Exp $
 */

package simkin;
import java.io.PrintStream;

/**
 * This class provides an interface to System.out.println
 */
final public class Tracer {
    /**
     * This variable controls whether the output is printed to stdout or not - by default the value is true
     */
    public static boolean g_Tracing=true;
    /**
     * This variable holds the output writer, by default this is System.out
     */
    public static PrintStream g_Out=System.out;
    /**
     * This method causes the given message to be printed to g_Out (if g_Tracing is true)
     */
    public static void trace(String msg){
	if (g_Tracing)
	    g_Out.println(msg);
    }
    /**
     * This method dumps the given exception to stdout (if g_Tracing is true)
     */
    public static void trace(Exception e){
	if (g_Tracing)
	    e.printStackTrace();
	//	    e.printStackTrace(g_Out);
    }
}
